package com.xs.anxingo.server.helper;

import com.xs.anxingo.server.api.req.BaseRequest;
import com.xs.anxingo.server.exception.BusinessException;
import com.xs.anxingo.server.exception.ErrorType;
import org.springframework.util.StringUtils;

/**
 * Created by Administrator on 2019/12/10.
 */
public class APIHelper {


    /**
     * 校验参数
     *
     * @param reqString
     */
    public static void checkReqString(String reqString) {
        if (StringUtils.isEmpty(reqString)) {
            throw new BusinessException(ErrorType.COMMON_ERROR, "入参为空");
        }
    }

    public static void checkRequest(BaseRequest request) {
        String info = request.verification();
        if (!StringUtils.isEmpty(info)) {
            throw new BusinessException(ErrorType.COMMON_ERROR, info);
        }
    }

}
